<?php

declare(strict_types=1);
/**
 * This file is part of habo_new_media.
 *
 * @link     https://www.berlen.cn/
 * @contact  tech@berlen.cn
 * @license  http://gitlab.rehou.cn/habo/habo_new_media/-/blob/master/README.md
 */
namespace app\service\finance;

use app\model\mysql\DeductionAccountModel;

final class DeductionService extends FinanceService
{
    /**
     * 获取核减金额.
     * @param int $accountId 账户Id
     * @param int $month 月份
     * @return float
     */
    public static function getDeductionAmount(int $accountId = 0, int $month = 0): float
    {
        return (new DeductionAccountModel())
            ->where('account_id', $accountId)
            ->where('month', $month)
            ->sum('cash_amount');
    }
}
